package carsharing;

public class Coordinates {
	
	private int x, y;
	
	public Coordinates(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public Coordinates copy() {
		Coordinates coord = new Coordinates(this.x, this.y);
		return coord;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}
	
	public int distance(Coordinates j) {
		return Math.abs(this.x - j.getX()) + Math.abs(this.y - j.getY());
	}
	
	public void print() {
		if(x < 10) System.out.print("0");
		System.out.print(x);
		System.out.print(", ");
		if(y < 10) System.out.print("0");
		System.out.print(y);
	}


}
